<!-- 我的查询 -->

<template>
  <WebSearch :param="param" :superNoLabel="false" @search="toSearch" @reset="toReset">
    <template #btn>
      <BtnAdd />
      <BtnPrimary plain title="导出" @click="startDownload" />
    </template>

    <ParamDateRange tip="入职起始日，入职截止日" bind="beginDate, endDate" history />
    <ParamDate tip="入职日期" history />
    <ParamTree tip="部门" bind="organId" :dict="organ_treeDict" :grayed="grayed" />
    <ParamSelect tip="角色" bind="roleId" :dict="role_selectDict" hasRight />
    <ParamInput tip="姓名" bind="name" />
    <ParamStatus narrow />

    <template #super>
      <div>
        <SuperInput label="姓名" bind="name" quar />
        <SuperInput label="手机" bind="phone" quar />
        <SuperInput label="身份证" bind="idNo" quar />
        <SuperStatus label="状态" quar />
      </div>

      <div>
        <SuperSelect label="角色" bind="roleId" :dict="role_selectDict" hasRight double eighth3 />
        <SuperDateRange label="入职日期" tip="入职起始日，入职截止日" bind="beginDate, endDate" history eighth3 />
        <SuperDate label="入职日期" quar />
      </div>

      <div>
        <SuperTree label="部门" bind="organId" :dict="organ_treeDict" :grayed="grayed" eighth3 />
        <SuperTimeRange label="失效时间" tip="失效起始时间，失效截止时间" bind="beginTime, endTime" future half />
        <SuperSwitch label="开关" eighth />
      </div>
    </template>
  </WebSearch>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import UTIL from './UTIL'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MySearch',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixLoad(), CORE.mixSelect('role', 'role_'), CORE.mixTree('organ', 'organ_')],

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 置灰列表
     */
    grayed() {
      const grayed = []
      UTIL.setGrayed(grayed, this.organ_tree)
      return grayed
    },
  },

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 查询事件
     */
    toSearch(e) {
      CORE.logInfo('WebSearch：查询事件', {}, e)
    },

    /**
     * 重置事件
     */
    toReset(e) {
      CORE.logInfo('WebSearch：重置事件', {}, e)
    },
  },
}
</script>
